package com.andong.controller;

import com.andong.annotations.AccessControl;
import com.andong.domain.entity.SubjectProgress;
import com.andong.domain.pojo.Result;
import com.andong.service.SubjectProgressService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

import static com.andong.utils.SystemConstant.*;

/**
 * 题库进度表(SubjectProgress)表控制层
 *
 * @author makejava
 * @since 2024-01-16 19:05:59
 */
@RestController
@RequestMapping("/subjectProgress")
public class SubjectProgressController {
    /**
     * 服务对象
     */
    @Resource
    private SubjectProgressService subjectProgressService;

    @PostMapping()
    @AccessControl(roles = STUDENT)
    public Result saveOrUpdate(@RequestBody SubjectProgress subjectProgress) {
        return subjectProgressService.addOrUpdate(subjectProgress);
    }

    @GetMapping()
    @AccessControl(roles = STUDENT)
    public Result getProgress(Long id, Integer type) {
        return subjectProgressService.getProgress(id, type);
    }
}

